package com.example.demo.config.event.action;

import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.action.Action;

import com.example.demo.app.entity.FormEntity;
import com.example.demo.config.enum_.ComplexFormEvents;
import com.example.demo.config.enum_.ComplexFormStates;
import com.example.demo.utils.RedisUtil;

/**
 * 复杂表单 
 * @author hello
 *
 */
public class ComplexFormChoiceAction implements Action<ComplexFormStates, ComplexFormEvents> {

	@Override
	public void execute(StateContext<ComplexFormStates, ComplexFormEvents> context) {
		System.out.println("表单当前的状态=====>"+"into ComplexFormChoiceAction");
		FormEntity form = context.getMessage().getHeaders().get("form", FormEntity.class);
		RedisUtil.set(form.getId(), form);
		System.out.println(form);
		System.out.println(context.getStateMachine().getState());
	}
	
}
